part of "../factory.dart";
// 以下的面积单位均为㎡

/// 根据吨价计算每张价格
double calcSheetPrice(double weightGSM, double area, double tonPrice) {
  // 先计算每克的价格
  double pricePerGram = tonPrice / 1000000; // 1吨 = 1000000克

  // 计算单张纸的总克重
  double sheetWeightInGrams = weightGSM * area;

  // 计算每张纸的价格
  double sheetPrice = sheetWeightInGrams * pricePerGram;

  return sheetPrice;
}

/// 根据每张价格计算吨价
double calcTonPrice(double weightGSM, double area, double sheetPrice) {
  // 计算单张纸的总克重
  double sheetWeightInGrams = weightGSM * area;

  // 计算每吨的价格
  double tonPrice =
      (sheetPrice / sheetWeightInGrams) * 1000000; // 1吨 = 1000000克

  return tonPrice;
}
